#pragma once

#include <vector>

class SampleMarker;
class SampleMarkerCallback
{
public:
	virtual void NotifyMarker(SampleMarker* marker) = 0;
};

/*
Each instance of this class carries extra information about a sample that it is attached to.
See MarkerType documentation for what information can be kept here.
*/
class SampleMarker
{
public:
	/*
	The marker's effects last from index until endIndex. The period from index until endIndex is called marker's area in the below documentation.	
	*/
	enum MarkerType {
		PreStopConsonant,//Marker's area comes before a stop consonant
		StopConsonant,//Marker's area denotes the period of a stop consonant
		PostStopConsonant,//Marker's area comes next after a stop consonant
		Voiced,//Marker's area is a voiced sample
		Unvoiced,//Marker's area is an unvoiced sample
		Callback,//Marker means that right before sample goes to playback, ((SampleMarkerCallback*)param1)->NotifyMarker(currentMarker) gets called.
		UserDefined,//User defined, set automatically in parameter-less constructor
	};

	SampleMarker(void);
	~SampleMarker(void);
	SampleMarker(unsigned int index, unsigned int endIndex, MarkerType type);

	/*
	Populates 'toMarkers' with markers in 'fromMarkers' whose index and endIndex are between 'from' and 'to'.
	The resulting markers have their index and endIndex decreased by 'from'.
	*/
	static void GetRegion(unsigned int from, unsigned int to, std::vector<SampleMarker>& fromMarkers, std::vector<SampleMarker>& toMarkers);

	unsigned int index;
	unsigned int endIndex;
	MarkerType type;
	long param1;
	long param2;
};
